﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BLL;
using System.Data.SqlClient;

namespace DAL
{
    public class DALLoaiSanPham
    {
        public static List<BLL.BLLLoaiSanPham> GetAll()
        {
            List<BLL.BLLLoaiSanPham> result=new List<BLLLoaiSanPham>();
            TMDTDataContext tmdtdb =DALCommon.TMDTDB;
            var dds=from dd in tmdtdb.LoaiSanPhams
                    select new BLLLoaiSanPham(dd.IDLoaiSanPham,dd.TenLoaiSanPham);
            result = dds.ToList<BLLLoaiSanPham>();
            return result;
        }
        public static List<BLL.BLLLoaiSanPham> GetById(string idloai)
        {
            List<BLL.BLLLoaiSanPham> result = new List<BLLLoaiSanPham>();
            TMDTDataContext tmdtdb = DALCommon.TMDTDB;
            var dds = from dd in tmdtdb.LoaiSanPhams
                      where dd.IDLoaiSanPham == idloai
                      select new BLLLoaiSanPham(dd.IDLoaiSanPham, dd.TenLoaiSanPham);
            result = dds.ToList<BLLLoaiSanPham>();
            return result;
        }
    }
}
